<template>
  <rx-dialog @handOk="handleSubmit" @cancel="cancel">
    <a-form :form="form">
      <a-form-item style="display:none">
        <a-input v-decorator="['dicId']"/>
        <a-input v-decorator="['parentId',{initialValue:mdl.parentId}]"/>
        <a-input v-decorator="['treeId',{initialValue:mdl.treeId}]"/>
      </a-form-item>

      <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="i18n('form.itemName','项名')">
        <a-input :placeholder="i18n('form.itemName','项名')" v-decorator="['name', {rules: [{required: true, message: i18n('form.itemName','项名','input')}]}]"/>
      </a-form-item>
      <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="i18n('form.itemValue','项值')">
        <a-input :placeholder="i18n('form.itemValue','项值')" v-decorator="['value', {rules: [{required: true, message: i18n('form.itemValue','项值','input')}]}]"/>
      </a-form-item>
      <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$ti18('rxList.index','序号')">
        <a-input-number :min="0" :max="1000000" :placeholder="$ti18('rxList.index','序号')" v-decorator="['sn', {rules: [{required: true, message: $ti18('rxList.index','序号','input')}]}]"/>
      </a-form-item>
    </a-form>
  </rx-dialog>
</template>
<script>
  import SysDicApi from '@/api/system/core/sysDic'
  import {BaseForm, RxDialog} from "@lowcode/jpaas-common-lib";
  export default {
    name: 'SysDicEdit',
    mixins:[BaseForm],
    props: {
      data:Object,
      layerid: String,
      lydata: Object,
      destroy: Function,
    },
    data() {
      return {

      }
    },
    components: {
      RxDialog,
    },
    methods: {
        i18n(name, text, key) {
            return this.$ti18(name, text, "sysDic", key);
        },
      onload_(vals){
        if(!this.pkId){
          Object.assign(this.mdl,this.data);
          console.info(this.mdl);
        }
      },
      get(id){
        return SysDicApi.get(id);
      },
      save(values){
        return SysDicApi.save(values);
      },

    }
  }
</script>
